//
//  CommitteesByStreetService.m
//  HZHome
//
//  Created by SunShine on 13-10-13.
//  Copyright (c) 2013年 xzysun. All rights reserved.
//

#import "CommitteesByStreetService.h"
#import "StreetInfoCell.h"
#import "StreetInfoItem.h"

@implementation CommitteesByStreetService

-(id)init
{
    self = [super init];
    if (self) {
        _dataItemName = @"StreetInfoItem";
    }
    return self;
}

-(void)loadDataWithKey:(NSString *)keyOrNil
{
    _currentPageNo = 1;//刷新或查询的时候将请求页码变为1
    if (self.dataList) {
        self.dataList = nil;
    }
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    [params setValue:@"2" forKey:@"item_type"];
//    if (keyOrNil) {
//        [params setValue:keyOrNil forKey:@"title"];
//    } else {
//        [params setValue:@"" forKey:@"title"];
//    }
    [self doHttpPost:STREETSLIST headers:nil path:nil parameters:params];
}

-(void)loadMoreDataWithKey:(NSString *)keyOrNil
{
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    [params setValue:@"2" forKey:@"item_type"];
//    if (keyOrNil) {
//        [params setValue:keyOrNil forKey:@"title"];
//    } else {
//        [params setValue:@"" forKey:@"title"];
//    }
    [self doHttpPost:STREETSLIST headers:nil path:nil parameters:params];
}

-(void)configCell:(UITableViewCell *)cell atIndex:(NSIndexPath *)index
{
    StreetInfoItem *item = [self.dataList objectAtIndex:index.row];
    StreetInfoCell *tempCell = (StreetInfoCell *)cell;
    tempCell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    tempCell.titleLabel.text = item.item_name;
}

-(NSDictionary *)getTargetConfigForCellAtIndex:(NSIndexPath *)indexPath
{
    StreetInfoItem *item = [self.dataList objectAtIndex:indexPath.row];
    NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:@"居委会详情",@"key",item,@"dataItem", nil];
    return dic;
}
@end
